<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class MY_Controller extends CI_Controller {
	protected $data;
	protected $is_clear = false;
	function __construct(){
		parent::__construct();
		
		$this->data['title'] = lang('meta_title');
		$this->data['keywords'] = lang('meta_keyword');
		$this->data['description'] = lang('meta_description');

		//$this->load->driver('cache', array('adapter' => 'file', 'backup' => 'file'));
		
		//$this->is_clear = $this->input->get('ccache');
		
	}
	
	function render( $tpl = 'welcome_tpl', $return = false )
	{
		$this->data['current_class'] = $this->router->fetch_class();
		$footer = 'common/footer_tpl';
		
		if(empty($this->data['content_id'])){
			$this->data['content_id'] = 'content';
		}
		
		if('welcome' == $this->data['current_class']){
			$footer = 'common/home_footer_tpl';
		}
		
		if( $return ){
			$content = $this->load->view('common/header_tpl', $this->data, $return);
			$content .= $this->load->view(empty($tpl) ? 'welcome_tpl' : $tpl, $this->data, $return);
			$content .= $this->load->view($footer, $this->data, $return);
			return $content;
		}
		$this->load->view('common/header_tpl', $this->data);
		$this->load->view(empty($tpl) ? 'welcome_tpl' : $tpl, $this->data);
		$this->load->view($footer, $this->data);
	}
}